package org.kgc.alanhealth.controller;

import org.kgc.alanhealth.entity.HospitalComments;
import org.kgc.alanhealth.entity.HospitalForum;
import org.kgc.alanhealth.service.ForumService;

import org.kgc.alanhealth.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("forum")
@CrossOrigin(origins = "*")
public class ForumController {
    @Autowired
    ForumService forumService;

    @RequestMapping("insert")
    public Result addComment(@RequestBody HospitalForum hospitalForum) {
        if (forumService.insertAndUpdate(hospitalForum) > 0) {
            return Result.success("评论成功");
        } else {
            return Result.error("Insert failed");
        }
    }
}
